<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" />
		<link rel="stylesheet" href="css/Site.css" />
		<link rel="stylesheet" href="css/zy.all.css" />
		<link rel="stylesheet" href="css/font-awesome.min.css" />
		<link rel="stylesheet" href="css/amazeui.min.css" />
		<link rel="stylesheet" href="css/admin.css" />
		<style>
		
		</style>
	<body>
		<div class="dvcontent">

			<div>
				<!--tab start-->
				<div class="tabs">
					<div class="hd">
						<ul style="">
							<li style="box-sizing: initial;-webkit-box-sizing: initial;" class="on">编辑分类</li>
						</ul>
					</div>
			
	<div class="am-cf admin-main" style="padding-top: 0px;">
		<!-- content start -->
		<div class="admin-content">
			<div class="admin-content-body">
				
				<div class="am-g">
					<div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
						
					</div>
					<div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4"
						style="padding-top: 30px;">
						<form class="am-form am-form-horizontal"
							  action="#" method="post" id="form_update">
						
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									分类名称</label>
								<div class="am-u-sm-9">
									<input type="hidden" name="tid" th:value="${type.tid}"/>
									<input type="text" id="user-name" required
										placeholder="分类名称" name="tname" th:value="${type.tname}">
										<small>10字以内...</small>
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-intro" class="am-u-sm-3 am-form-label">
									描述</label>
								<div class="am-u-sm-9">
									<textarea class="" rows="5" id="user-intro" name="tdesc" th:value="${type.tdesc}"
										placeholder="输入描述"></textarea>
									<small>250字以内...</small>
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-intro" class="am-u-sm-3 am-form-label">
									备注</label>
								<div class="am-u-sm-9">
									<textarea class="" rows="5" id="user-intro" name="tremark" th:value="${type.tremark}"
										placeholder="输入备注"></textarea>
									<small>250字以内...</small>
								</div>
							</div>
							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3">
									<input type="button" onclick="update_type();"class="am-btn am-btn-success" value="添加分类" />
									<input type="button" class="am-btn am-btn-success" value="返回列表" />
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		
		</div>
		<!-- content end -->
	</div>
							<!-- end-->
						</ul>
					</div>
				</div>
				<!--tab end-->

			</div>

			
			 <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
              <script src="js/plugs/Jqueryplugs.js" type="text/javascript"></script>
              <script src="js/_layout.js"></script>
             <script src="js/plugs/jquery.SuperSlide.source.js"></script>
			<script>
				//异步更新
				function update_type() {
					var formdata=$("#form_update").serialize();
					//缺不缺点东西??
					//alert(formdata);
					$.ajax({
						url:"/type_update",
						type:"post",
						data:formdata,
						dataType:"json",
						success:function (result) {
							//alert(JSON.stringify(result));
							if(result.code==200){
								alert("更新成功!");
								location.href="/typeList";
							}else{
								alert("更新失败,你看看BUG!!!!!");
							}
						}
					});
				}
			</script>

		</div>
	</body>

</html>